-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defaults content_type to application/octet-stream in blob_record.js #38124
Conversation
Some other options:
|
38fdb12
to
33afa7a
Compare
Defaults content_type to application/octet-stream in blob_record.js [direct_upload_xls_in_chrome]
33afa7a
to
1d133e8
Compare
Thanks! |
@javan I noticed https://contributors.rubyonrails.org wrongly credited this commit to the branch name because it was in square brackets in the commit. Very much not important, but wondering if there's a way to manually overwrite? Thanks |
Wups! Opened rails/rails-contributors#146 to fix that up. |
Thanks @javan! |
It seems like the npm package (https://www.npmjs.com/package/@rails/activestorage) hasn't reflected the changes in this commit yet. The PR conversation is most likely not the right place to ask, but how can I implement this commit without waiting for the npm package to update? |
inludes fix made here: rails/rails#38124 Otherwise it's identical to 6.0.2.1
inludes fix made here: rails/rails#38124 Otherwise it's identical to 6.0.2.1
@carlaraya I basically forked the Rails repo from the 6.0.2.1 release, cherry-picked the commit that made this fix, then extracted the So in my case, adding the patched package with yarn became: |
Defaults content_type to application/octet-stream in blob_record.js
I just backported this in 2c19a6e so it'll go out in the next release. |
This reverts commit 653902b.
Great! Thank you so much!! I was just facing this issue after updating to rails 6. When is the next update including this fix for the npm package planned to happen? The las update was 5 months ago. |
@maurobender the package you linked to is no longer used for Rails 6 (for Rails 5 only it seems). You can find the updated package here: https://www.npmjs.com/package/@rails/activestorage |
Thanks a lot @smartygus! Any chance of adding this to the guides (maybe here)? |
@maurobender do you mean something to explain that the npm packages have moved? This is mentioned in the guide for upgrading from Rails 5.2 to Rails 6, and I think that's probably the most appropriate place to document such changes: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#all-npm-packages-have-been-moved-to-the-@rails-scope Or did you have something else in mind? |
@@ -550,7 +550,7 @@ | |||
this.file = file; | |||
this.attributes = { | |||
filename: file.name, | |||
content_type: file.type, | |||
content_type: file.type || "application/octet-stream", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it makes sense to set null: false
for content_type in the migration, since it should never be NULL and causes errors if it is NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a good idea. Would you like to make a PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: #43055
As of rails#38124 (Jan, 2020), it has a default value so it will never be NULL.
Summary
Defaults content_type to application/octet-stream in blob_record.js in order to resolve #38123.
@cushingw recommended this solution here #36514 (comment).
Closes #38123